﻿using System.Text.RegularExpressions;

namespace zijian666.Data.SqlBuilders;
internal class CommonBuilder(DbProviderFactory factory) : TSqlBuilder
{
    public override string PagingSql(string sql, long begin, int count)
    {
        return $"{sql.TrimSemicolon()} LIMIT {begin},{count};";
    }
    public override string ConvertCountSql(string sql)
    {
        return $"SELECT COUNT(1) FROM ({sql.TrimSemicolon()}) AS T;";
    }
    public override DbProviderFactory DbProvider => factory;
}
